/**
 * Created by oiuyt on 2018/7/18.
 */
import React, { Component } from 'react';
import {
    Form, Icon, Input, Button, Checkbox,
} from 'antd';

const FormItem = Form.Item;

class NormalLoginForm extends Component {
    constructor(props) {
            super(props);
            console.log(this.props)
            this.state = {};
    }
    handleSubmit = (e) => {
            e.preventDefault();
            this.props.form.validateFields((err, values) => {
                    if (!err) {
                            console.log('Received values of form: ', values);
                    }
            });
    }
    render() {
            const { getFieldDecorator } = this.props.form;
            return (
                <div id="form-login-container">
                        <h1>后台管理系统</h1>
                        <Form onSubmit={this.handleSubmit} className="login-form">
                                <FormItem>
                                        {getFieldDecorator('userName', {
                                                rules: [{ required: true, message: '请输入用户名!' }],
                                        })(
                                            <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="用户名" />
                                        )}
                                </FormItem>
                                <FormItem>
                                        {getFieldDecorator('password', {
                                                rules: [{ required: true, message: '请输入密码!' }],
                                        })(
                                            <Input prefix={<Icon type="lock" style={{ color: 'rgba(0,0,0,.25)' }} />} type="password" placeholder="密码" />
                                        )}
                                </FormItem>
                                <FormItem>
                                        {getFieldDecorator('remember', {
                                                valuePropName: 'checked',
                                                initialValue: true,
                                        })(
                                            <Checkbox>记住密码</Checkbox>
                                        )}
                                        <a className="login-form-contact" href="">联系管理员</a>
                                        <Button type="primary" htmlType="submit" className="login-form-button">
                                                登 录
                                        </Button>
                                        <a href="">返回网站主页</a>
                                </FormItem>
                        </Form>
                </div>
            );
    }

}

const Login = Form.create()(NormalLoginForm);

export default Login
